public class MoveZeroes {
    public void moveZeroes(int[] nums) {
        int off=0;
        for(int i=0;i<nums.length-off;i++){
            if (nums[i]==0){
                for(int j=i;j<nums.length-1;j++){
                    nums[j] = nums[j+1];
                    nums[j+1] = 0;
                }
                i--;
                off++;
            }
        }
    }
    public void moveZeroes2(int[] nums){
        int lastNoneZeroFoundAt = 0;
        for(int i=0;i<nums.length;i++){
            if(nums[i]!=0){
                nums[lastNoneZeroFoundAt]=nums[i];
                lastNoneZeroFoundAt++;
            }
        }
        for(int i = lastNoneZeroFoundAt;i<nums.length;i++){
            nums[i] = 0;
        }
    }
    public void moveZeroes3(int[] nums){
        for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.length; cur++) {
            if (nums[cur] != 0) {
                int temp = nums[cur];
                nums[cur] = nums[lastNonZeroFoundAt];
                nums[lastNonZeroFoundAt] = temp;
                lastNonZeroFoundAt++;
            }
        }
    }
}